package net.huashitong.Indicators.service;

import com.sirdc.modules.sys.entity.SysScheduleJob;
import com.sirdc.modules.sys.filter.SysScheduleJobFilter;
import com.sirdc.modules.sys.service.RedisService;
import com.sirdc.modules.sys.service.SysScheduleJobService;
import org.quartz.SchedulerException;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;


import java.util.List;
import java.util.TimerTask;

/**
 * 第二阶段开始
 */

public class SecondProjectJobService extends TimerTask {

    private AB01Service ab01Service;

    private BA01Service ba01Service;

    private AB02Service studentService;
    private BA02Service ba02Service;


    private RedisService redisService;


    private SysScheduleJobService scheduleJobService;


    private ScheJobService scheJobService;

    private  String message;

    public SecondProjectJobService(ScheJobService scheJobService, String message,SysScheduleJobService scheduleJobService) {

        this.scheJobService = scheJobService;
        this.message = message;
        this.scheduleJobService = scheduleJobService;
    }

    @Override
    public void run() {

        System.out.println("--------第二阶段时间" + message + "------");

        SysScheduleJobFilter filter  = new SysScheduleJobFilter();
        filter.setJobName("JobService");
        List<SysScheduleJob> list  = scheJobService.getJobs(filter);
        try {
            scheduleJobService.updateStatus2Resume(list.get(0).getSysId());//开启每分钟一次
        } catch (SchedulerException e) {
            e.printStackTrace();
        }
    }
}
